class Solution:
    # @param n, an integer
    # @return an integer
    def reverseBits(self, n):
        res = [0] * 32
        index = 31
        while n//2:
            res[index] = n % 2
            n //= 2
            index -= 1
        res[index] = n

        res_num = 0
        for i in range(len(res)):
            res_num += res[i] * 2 ** i
        return res_num

class Solution:
    # @param n, an integer
    # @return an integer
    def reverseBits(self, n):
        m = bin(n)[2:].zfill(32)# bin对数字求二进制输出字符串， zfill对字符串填充0至指定宽度
        return int(m[::-1],2)# int函数可以指定几进制



test = Solution()
print(test.reverseBits(43261596))
